<template>
	<div>
		<u-parse :content="content" @preview="preview" @navigate="navigate"  class="rich-text"/>
	</div>
</template>
<script>
	import uParse from '@/components/gaoyia-parse/parse.vue'
	export default{
		data(){
			return{
				msgId:'',
				content:'<img style="width:20px;height:20px;display: inline-block;vertical-align: top;" src="https://rzkeji.oss-cn-shenzhen.aliyuncs.com/web/bbMachine/invitation-vote.png" alt=""><span stlye="color:#128FFF;">投票</span>'
			}
		},
		components: {
		    uParse
		  },
		methods:{
			preview(src, e) {
			      // do something
			    },
			navigate(href, e) {
			  // do something
			},
			async getSysNewsDetail(){
				let params={
					user_token:uni.getStorageSync('userToken'),
					id:this.msgId
				}
				let res=await this.$api.getSysNewsDetail(params);
				if(res.data.level=='success'){
					this.content=res.data.data.content
				}else{
					uni.showToast({
						icon:'none',
						title:res.data.message
					})
				}
			}
		},
		onLoad(options) {
			this.msgId=options.msgId||'';
			this.getSysNewsDetail()
		}
	}
</script>
<style>
	.rich-text{
		padding:20rpx;
	}
	
	.rich-text img{
		max-width:100% !important;
	}
</style>